package main

import "fmt"

type Person struct {
	Name string
	Age  int
}

func (p Person) Format(f fmt.State, verb rune) {
	switch verb {
	case 's', 'v':
		f.Write([]byte(fmt.Sprintf("Name: %s, Age: %d", p.Name, p.Age)))
	case 'd':
		f.Write([]byte(fmt.Sprintf("Age: %d", p.Age)))

	default:
		f.Write([]byte("unsupported verb"))
	}
}

func main() {
	person := Person{
		Name: "111",
		Age:  22,
	}

	fmt.Printf("%s\n", person)
	fmt.Printf("%v\n", person)
	fmt.Printf("%d\n", person)
}
